<template>
  <a-drawer
    :maskClosable="false"
    :title="title"
    :width="width"
    placement="right"
    :closable="false"
    destroyOnClose
    @close="close"
    :visible="visible">
    <erp-seal-certification-change-record-form   ref="realForm" @ok="submitCallback" @unButtonDisable="unButtonDisable" :disabled="disableSubmit" normal></erp-seal-certification-change-record-form>
    <div class="drawer-footer">
      <a-popconfirm title="确定关闭弹窗吗?" @confirm="handleCancel" :getPopupContainer="(node) =>  node.parentNode">
        <a-button style="margin-bottom: 0;">关闭</a-button>
      </a-popconfirm>
      <a-button v-if="!disableSubmit" :disabled="buttonDisable" @click="handleOk" type="primary" style="margin-bottom: 0;">保存</a-button>
    </div>
  </a-drawer>
</template>
<!--:is-show="isShow"-->
<script>

import ErpSealCertificationChangeRecordForm from './ErpSealCertificationChangeRecordForm'

export default {
    // props: ['isshow'],
    // props:["returnShow"],

    name: 'ErpSealCertificationChangeRecordModal',
    components: {
      ErpSealCertificationChangeRecordForm
    },
    data () {
      return {
        is_show: 0,
        title:"操作",
        width:896,
        visible: false,
        disableSubmit: false,
        buttonDisable: false
      }
    },
    created(){
      // console.log("ChangeModel-------",this.returnShow);
    },
    methods: {
      add (is_show) {
        this.buttonDisable = false;
        console.log("isshow111",is_show);
        this.visible=true;
        this.$nextTick(()=>{
          //确认提交流程吗?
          this.$refs.realForm.add(is_show);
        })
      },
      edit (record) {
        this.buttonDisable = false;
        console.log("Model---edit---------",record)
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        });
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleOk () {
        this.buttonDisable = true;
        console.log("--------handleOk");
        this.$refs.realForm.submitForm();
      },
      handleCancel () {
        this.close()
      },
      unButtonDisable () {
        this.buttonDisable = false
      }
    }
  }
</script>

<style lang="less" scoped>
/** Button按钮间距 */
  .ant-btn {
    margin-left: 30px;
    margin-bottom: 30px;
    float: right;
  }
  .drawer-footer{
    position: absolute;
    bottom: -8px;
    width: 100%;
    border-top: 1px solid #e8e8e8;
    padding: 10px 16px;
    text-align: right;
    left: 0;
    background: #fff;
    border-radius: 0 0 2px 2px;
  }
</style>
